package com.mercycrazy.recruit.converter;

import com.mercycrazy.recruit.enums.ShowWhichName;

import javax.persistence.AttributeConverter;

/**
 * 名称展示类型枚举属性转换器
 *
 * @author <a href="mailto:1443424326@qq.com">mercycrazy</a>
 * @see com.mercycrazy.recruit.enums.ShowWhichName
 * @since 2023-01-14
 */
public class ShowWhichNameConverter implements AttributeConverter<ShowWhichName, Integer> {

    @Override
    public Integer convertToDatabaseColumn(ShowWhichName showWhichName) {
        return showWhichName.getType();
    }

    @Override
    public ShowWhichName convertToEntityAttribute(Integer type) {
        return ShowWhichName.of(type);
    }
}
